import numpy as np
import pandas as pd
from flask import current_app

from app.services.models.file_model import FileModel


class LugangActivinessShortModel(FileModel):

    def __init__(self):
        super().__init__(model_name="lugang_activiness_short")

    def process(self, temp_model_input):
        try:

            input_df = pd.DataFrame([temp_model_input])

            predict = self.model_instance.predict(input_df)
            response = predict[0].astype(np.unicode)
            return response

        except Exception as e:
                current_app.logger.info(e)


# 用导出module的方法创建单例
lugang_activiness_short = LugangActivinessShortModel()
